<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function index(){
      $username=$_POST['username'];
      echo $username;
      $this->display();
    }
    public function login(){
      $m=D('User');
      
      $data['username']=$_POST['username'];
      $data['password']=$_POST['password'];
      $result=$m->where($data)->count();
      
      
      if ($result>0)
         {
          $this->success('登录成功','index',1) ;
         }
        else{
          $this->error('登录失败','index',1) ;
        }
    }

    public function __empty(){
      $this->display();
    }
}